<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.SearchEmployeesTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.CreateEmployeesLabel_businessEmail}" for="businessEmail" />
                    <p:autoComplete id="searchText" value="#{employeesController.searchText}" completeMethod="#{employeesController.autocomplete}"/>
                </h:panelGrid>
                <h:commandButton action="#{employeesController.search}" value="#{bundle.SearchEmployeesLink}" />
                 <h:panelGroup rendered="#{employeesController.searchItems.rowCount > 0}">
                    <h:outputText value="#{employeesController.searchPagination.pageFirstItem + 1}..#{employeesController.searchPagination.pageLastItem + 1}/#{employeesController.searchPagination.itemsCount}"/>&nbsp;
                    <h:commandLink action="#{employeesController.previous}" value="#{bundle.Previous} #{employeesController.searchPagination.pageSize}" rendered="#{employeesController.searchPagination.hasPreviousPage}"/>&nbsp;
                    <h:commandLink action="#{employeesController.next}" value="#{bundle.Next} #{employeesController.searchPagination.pageSize}" rendered="#{employeesController.searchPagination.hasNextPage}"/>&nbsp;
                    <h:dataTable value="#{employeesController.searchItems}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEmployeesTitle_firstName}"/>
                            </f:facet>
                            <h:outputText value="#{item.firstName}"/>
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEmployeesTitle_lastName}"/>
                            </f:facet>
                            <h:outputText value="#{item.lastName}"/>
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEmployeesTitle_businessEmail}"/>
                            </f:facet>
                            <h:outputText value="#{item.businessEmail}"/>
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEmployeesTitle_skype}"/>
                            </f:facet>
                            <h:outputText value="#{item.skype}"/>
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEmployeesTitle_phoneNumber}"/>
                            </f:facet>
                            <h:outputText value="#{item.phoneNumber}"/>
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEmployeesTitle_mobile1}"/>
                            </f:facet>
                            <h:outputText value="#{item.mobile1}"/>
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEmployeesTitle_mobile2}"/>
                            </f:facet>
                            <h:outputText value="#{item.mobile2}"/>
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEmployeesTitle_status}"/>
                            </f:facet>
                            <h:outputText value="#{item.status}"/>
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEmployeesTitle_type}"/>
                            </f:facet>
                            <h:outputText value="#{item.type}"/>
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEmployeesTitle_jobTitle1}"/>
                            </f:facet>
                            <h:outputText value="#{item.jobTitle1.jobTitle}"/>
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListEmployeesTitle_jobTitle2}"/>
                            </f:facet>
                            <h:outputText value="#{item.jobTitle2.jobTitle}"/>
                        </h:column>
                        
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="&nbsp;"/>
                            </f:facet>
                            <h:commandLink action="#{employeesController.prepareView}" value="#{bundle.ListEmployeesViewLink}"/>
                            <h:outputText value=" "/>
                            <h:commandLink action="#{employeesController.prepareEdit}" value="#{bundle.ListEmployeesEditLink}"/>
                            <h:outputText value=" "/>
                            <h:commandLink action="#{employeesController.destroy}" value="#{bundle.ListEmployeesDestroyLink}"/>
                             <h:outputText value=" "/>
                            <h:commandLink action="#{employeesController.resetPassword}" value="#{bundle.ResetEmployeesPasswordLink}"/>
                        </h:column>
                    </h:dataTable>
                </h:panelGroup>
                <h:commandButton value="#{bundle.CreateEmployeesIndexLink}" action="/index" />
            </h:form>
        </ui:define>
    </ui:composition>
</html>
